<template>
  <el-container style="height: 100%; border: 1px solid #eee">
    <el-aside :width="aside_width"
              style="background-color: rgb(238, 241, 246); margin-left: -1px;margin-bottom:-1px;">
      <Aside :isCollapse="isCollapse"></Aside>
    </el-aside>

    <el-container style="height: 100%">
      <el-header
          style="text-align: right; font-size: 12px;height: 100%;border-bottom: rgba(168,168,168,0.3) 1px solid">
        <Header @doCollapse="doCollapse" :icon="icon"></Header>
      </el-header>

      <el-main style="height: 100%;">
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  name: "Index",
  components: {
    Aside: () => import("@/components/common/Aside"),
    Header: () => import("@/components/common/Header"),
  },
  data() {
    return {
      isCollapse: false,
      aside_width: '200px',
      icon: 'el-icon-s-fold',
    }
  },
  created() {
    this.$store.commit('setUser', JSON.parse(localStorage.getItem('user')))
  },
  methods: {
    doCollapse() {
      this.isCollapse = !this.isCollapse;
      if (this.isCollapse) { // 收缩
        this.aside_width = '64px';
        this.icon = 'el-icon-s-unfold'
      } else {  //展开
        this.aside_width = '200px';
        this.icon = 'el-icon-s-fold'
      }
    },
  },
}
</script>

<style scoped>

</style>
